home *** CD-ROM | disk | FTP | other *** search
- /*
- * DrawEffect.c
- * Linda McLennan
- * COPYRIGHT © 1989 Ventana Software
- */
-
- #include "BWit.h"
- #include "Fuzzy.h"
-
- DrawEffect( tDataPtr, fzDataHandle )
-
- ToolDataPtr tDataPtr;
- FuzzyDataHandle fzDataHandle;
-
- {
- GrafPtr dPort;
- short n, theEffect;
- short halfSize, numPts;
- Point offset;
- FuzzyDataPtr fzDataPtr;
-
- HLock( fzDataHandle );
- fzDataPtr = *fzDataHandle;
- theEffect = fzDataPtr->whichEffect;
- if ( theEffect == crosshatch )
- numPts = 1;
- else
- numPts = 8;
-
- halfSize = (fzDataPtr->brushSize)/2;
-
- for ( n = 1; n <= numPts; n++ )
- {
- /* get random offset from current */
- /* mouse within size of brush */
- offset.h = Random() % halfSize;
- offset.v = Random() % halfSize;
-
- switch( theEffect )
- {
- case fuzzy:
- MoveTo( tDataPtr->newPoint.h,
- tDataPtr->newPoint.v );
- Line( offset.h, offset.v);
- break;
-
- case furry:
- MoveTo( tDataPtr->newPoint.h + offset.h,
- tDataPtr->newPoint.v + offset.v );
- Line( offset.h, offset.v);
- break;
-
- case crosshatch:
- MoveTo( tDataPtr->newPoint.h + offset.h,
- tDataPtr->newPoint.v + offset.v );
- Line( 7, 0);
- MoveTo( tDataPtr->newPoint.h + offset.h + 1,
- tDataPtr->newPoint.v + offset.v - 2);
- Line( 6, 6 );
- break;
- }
- }
-
- HLock( fzDataHandle );
-
- /* compute update area and add pen size */
- Pt2Rect(tDataPtr->oldPoint, tDataPtr->newPoint,
- &tDataPtr->updateRect );
- InsetRect( &tDataPtr->updateRect,
- -halfSize, -halfSize );
-
- if ( theEffect == furry )
- InsetRect( &tDataPtr->updateRect,
- -halfSize, -halfSize );
-
- GetPort( &dPort );
- tDataPtr->updateRect.right += dPort->pnSize.h;
- tDataPtr->updateRect.bottom += dPort->pnSize.v;
- }
-